<?php
class CV_Filter_Array_Keys extends CV_Filter_Decorator_Abstract {
	public function filter( $value ){
		if ( ! is_array($value) ){
			throw new Zend_Filter_Exception('Value to filter must be an array');
		}
		$new_value = array();
		foreach( $value as $key => $elem ) {
			if ( !empty($this->_options['recursive']) && is_array( $elem ) ){
				$new_value[ $this->_filter->filter($key) ] = $this->filter( $elem );
			} else {
				$new_value[ $this->_filter->filter($key) ] = $elem;
			}
		}
		return $new_value;
	}	
}